package cn.tedu.oa_system.mapper;

import cn.tedu.oa_system.pojo.Attends;
import cn.tedu.oa_system.pojo.in.FindLikeKeyIn;
import cn.tedu.oa_system.pojo.vo.AttendsVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

/**
 * @Author MW
 * @Description 考勤mapper
 * @CreateDate 2023/2/26 23:53
 * @Entity:
 */
@Repository
public interface AttendsMapper extends BaseMapper<Attends> {

    /**
     * 统计当天的个人考勤记录
     */
    int countByToday(String date, String userName);

    /**
     * 查询个人当日下班考勤id
     */
    long findOffWorkId(String today, String userName);

    /**
     * 查询某用户某天的最新记录用来显示用户最新的考勤类型和时间
     */
    AttendsVO findLastAttends(String today, String userName);

    /**
     * 所有考勤列表分页查询
     */
    IPage<AttendsVO> listOfAll(Page<AttendsVO> page);

    /**
     * 所有考勤列表模糊分页查询
     */
    IPage<AttendsVO> findLikeKeyOfAll(Page<AttendsVO> page,@Param("likeKeyIn")FindLikeKeyIn likeKeyIn);

    /**
     * 个人查询考勤列表(分页)
     * @param userName
     * @return
     */
    IPage<Attends> listOfSelf(Page<Attends> page, String userName);

    /**
     * 个人考勤列表模糊查询
     */
    IPage<AttendsVO> findLikeKeyOfSelf(Page<AttendsVO> page,@Param("likeKeyIn")FindLikeKeyIn likeKeyIn, String userName);


}
